<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition 
    xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:sf="http://www.springframework.org/tags/faces"
    xmlns:p="http://primefaces.org/ui"

	template="/WEB-INF/layouts/standard.xhtml"
>
<ui:define name="notes">
	<p>Startseite</p>
</ui:define>

<ui:define name="content">
    <h:form id="campaignListForm">
        <h1>Willkommen zum Warhammer 40k Kampagnenplanner!</h1>
        <table>
            <ui:repeat value="${allCampaigns}" var="campaign">
                <tr>
	                <td><h:outputText value="${campaign.name}" /></td>
	                <td><h:outputText value="Aktiv/Pausiert/Ende" /></td>
	                <td>
	                    <h:commandLink id="editAction" action="editCampaign" ajax="false">
		                    <f:param name="campaignID" value="${campaign.id}" />
		                    <h:outputText value="bearbeiten" />
		                </h:commandLink>
	                </td>
                </tr>
		    </ui:repeat>
        </table>
        <p:dataTable var="campaign" value="#{allCampaigns}">
            <f:facet name="header">Folgende Kampagnen gibt es</f:facet> 
            <p:column headerText="Name">
                <h:outputText value="#{campaign.name}" />
            </p:column>
            <p:column headerText="Status">
                <h:outputText value="Aktiv/Pausiert/Ende" />  
            </p:column>
            <p:column headerText="Aktionen">
                <p:commandLink id="editAction" ajax="false" action="editCampaign">
                    <f:param name="campaignID" value="#{campaign.id}" />
                    <h:outputText value="bearbeiten" />
                </p:commandLink>
            </p:column>
        </p:dataTable>
        <p:commandLink id="createCampaign" ajax="false" action="createNewCampaign">
            <h:outputText value="Eine neue Kampagne erstellen" />
        </p:commandLink>&nbsp;
                        <h:commandLink id="editCampaign" action="editCampaign" ajax="false">
                            <f:param name="campaignID" value="2" />
                            <h:outputText value="bearbeiten" />
                        </h:commandLink>
    </h:form>
</ui:define>
</ui:composition>